/*
 *   Copyright (c) 2010-2022, SIUFUNG
 */
package net.siufung.market.base.log.login.controller.model.dto;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.extern.slf4j.Slf4j;
import net.siufung.core.utils.CopyUtil;
import net.siufung.market.base.log.login.mapper.entity.OperateLog;

import java.io.Serializable;

/**
 * <p>
 * 系统日志表 默认数据传参对象
 * </p>
 * @author 陈建峰
 * @since 2022-07-04 17:54:53
 */
@Slf4j
@Data
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="OperateLogDto", description="系统日志表默认数据传输对象")
public class OperateLogDto implements Serializable {

    private static final long serialVersionUID = 7735903319920166130L;
    /**
     * 主键id
     */
    @ApiModelProperty(value = "主键id")
    private Long id;

    /**
     * 日志类型
     */
    @ApiModelProperty(value = "日志类型")
    private String type;

    /**
     * 日志标题
     */
    @ApiModelProperty(value = "日志标题")
    private String title;

    /**
     * 用户名称
     */
    @ApiModelProperty(value = "用户名称")
    private String userName;

    /**
     * 用户id
     */
    @ApiModelProperty(value = "用户id")
    private String userId;

    /**
     * 登录名
     */
    @ApiModelProperty(value = "登录名")
    private String loginName;

    /**
     * 日志ip
     */
    @ApiModelProperty(value = "日志ip")
    private String remoteIp;

    /**
     * 日志链接
     */
    @ApiModelProperty(value = "日志链接")
    private String requestUri;

    /**
     * 方法
     */
    @ApiModelProperty(value = "方法")
    private String method;

    /**
     * 参数
     */
    @ApiModelProperty(value = "参数")
    private String params;

    /**
     * 异常
     */
    @ApiModelProperty(value = "异常")
    private String exception;

    /**
     * 请求用时
     */
    @ApiModelProperty(value = "请求用时")
    private Long time;

    /**
     * 应用id
     */
    @ApiModelProperty(value = "应用id")
    private Integer appId;

    /**
     * 租户id
     */
    @ApiModelProperty(value = "租户id")
    private Integer tenantId;

    /**
     * 转化成数据库实体
     * @return OperateLog
     */
    public OperateLog to(){
        OperateLog log = new OperateLog();
        CopyUtil.copyProperties(this, log);
        return log;
    }
}